package com.chixing.day03_oop.work;

/**
 * 1. 完成类的设计，属性使用合适的数据类型；其中 账户类型 0表示储蓄账户， 1表示信用账户
 */
public class Account {
    //账户账号
    private Integer accNo;
    //账户姓名
    private String accName;
    //账户密码
    private String accPassword;
    //账户手机号
    private String accTelno;
    //账户余额
    private Integer accBalance;
    //账户类型
    private Integer accType;

    public Account() {
    }

    /**
     * 3. 设计账户存款 depoist、取款 withdraw 两个方法，方法内部简单实现即可，
     *     需要注意方法定义的结构（参数列表、返回值）
     */

     //存款
    public void depoist(Integer money){
        this.setAccBalance(this.getAccBalance()+money);
        System.out.println("存款之后余额: "+this.getAccBalance());
    }

    //取款
    public void withdraw(Integer money){
        if(this.getAccBalance()-money>=0) {
            this.setAccBalance(this.getAccBalance() - money);
            System.out.println("取款之后余额: "+this.getAccBalance());
        }
        else
            System.out.println("余额不足，当前余额:"+this.getAccBalance()+" 取款金额: "+money);
    }

    /**
     * 2. 给各属性添加赋值与取值方法（set,get）
     */
    public Integer getAccNo() {
        return accNo;
    }

    public void setAccNo(Integer accNo) {
        this.accNo = accNo;
    }

    public String getAccName() {
        return accName;
    }

    public void setAccName(String accName) {
        this.accName = accName;
    }

    public String getAccPassword() {
        return accPassword;
    }

    public void setAccPassword(String accPassword) {
        this.accPassword = accPassword;
    }

    public String getAccTelno() {
        return accTelno;
    }

    public void setAccTelno(String accTelno) {
        this.accTelno = accTelno;
    }

    public Integer getAccBalance() {
        return accBalance;
    }

    public void setAccBalance(Integer accBalance) {
        this.accBalance = accBalance;
    }

    public Integer getAccType() {
        return accType;
    }

    public void setAccType(Integer accType) {
        this.accType = accType;
    }

    @Override
    public String toString() {
        return "Account{" +
                "accNo=" + accNo +
                ", accName='" + accName + '\'' +
                ", accPassword='" + accPassword + '\'' +
                ", accTelno='" + accTelno + '\'' +
                ", accBalance=" + accBalance +
                ", accType=" + accType +
                '}';
    }


}
